<?php

/**
 * product actions.
 *
 * @package    toolrental
 * @subpackage product
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class productActions extends sfActions
{
  public function executeShow(sfWebRequest $request)
  {
	  $this->menu_list = MenuPeer::getMenus();
	  $this->product = $this->getRoute()->getObject();
	  $this->category = $this->product->getCategory();
	  $this->safetys = $this->product->getProductSafetys();

	  //$criteria = new Criteria();
	  //$criteria->addAscendingOrderByColumn(self::PRICE);

	  $this->prices = $this->product->getProductPricecategorys();
  }

  public function executeSearch(sfWebRequest $request)
    {
      $this->menu_list = MenuPeer::getMenus();
      
      if (!$query = $request->getParameter('query'))
      {
        return $this->forward('category', 'index');
      }
 
      $this->products = ProductPeer::getForLuceneQuery($query);
    }
}
